package finalgame.GUI;

import org.lwjgl.input.Keyboard;
import org.newdawn.slick.Color;
import org.newdawn.slick.UnicodeFont;
import org.newdawn.slick.opengl.Texture;

import static org.lwjgl.input.Keyboard.KEY_A;
import static org.lwjgl.input.Keyboard.KEY_B;

import finalgame.Game;
import finalgame.Graphics.GraphicsConstants;
import finalgame.Graphics.Render2D;
import finalgame.Graphics.RenderEngine;
import finalgame.Graphics.RenderObj;

public class TransitoryStage implements RenderObj {
	private String text;
	
	public TransitoryStage(String text) {
		this.text = text;
	}
	
	public void render() {
		UnicodeFont font = Game.game.getFont("russian.lg");
		int width = font.getWidth(text);
		int height = font.getHeight(text);
		font.drawString(
			(GraphicsConstants.WIDTH - width) / 2,
			(GraphicsConstants.HEIGHT - height) / 2,
			text
		);
	}

	private int keyDown = -30;
	public void update() {
		if(keyDown < 0) {
			keyDown++;
			return;
		}
		if(Keyboard.isKeyDown(KEY_B) || Keyboard.isKeyDown(KEY_A)) {
			keyDown = 1;
		} else if(keyDown == 1) {
			Game.exit();
		}
	}

}
